
#include <stdio.h>
#include <stdlib.h>
#include "../core/epd420RWS19A.h"
#include "../core/epdpaint.h"
#include "../core/image/imagedata.h"
#include "../clock/clock.h"

#define COLORED      0
#define UNCOLORED    1

int main(void)
{

    Epd epd;
    if (epd.Init() != 0) {
        printf("e-Paper init failed\n");
        return -1;
    }

    // unsigned char* frame_black = (unsigned char*)malloc(epd.width * epd.height / 8);
    // unsigned char* frame_red = (unsigned char*)malloc(epd.width * epd.height / 8);

    // Paint paint_black(frame_black, epd.width, epd.height);
    // Paint paint_red(frame_red, epd.width, epd.height);
    // paint_black.Clear(UNCOLORED);
    // paint_red.Clear(COLORED);

    /* For simplicity, the arguments are explicit numerical coordinates */
    /* Draw something to the frame_buffer */
//    paint_black.SetRotate(ROTATE_270);
//    paint_red.SetRotate(ROTATE_270);    
    // paint_black.DrawRectangle(30, 80, 190, 280, COLORED);//x1,y1,x2,y2,Diagonal point
    // paint_black.DrawLine(30, 80, 190, 280, COLORED);//x1,y1,x2,y2
    // paint_black.DrawLine(190, 80, 30, 280, COLORED);//x1,y1,x2,y2
    // paint_red.DrawFilledRectangle(210, 80, 370, 280, UNCOLORED);//x1,y1,x2,y2,Diagonal point
    // paint_red.DrawCircle(290, 180, 60, COLORED);//x,y,r
    // paint_red.DrawFilledCircle(110, 180, 30, UNCOLORED);//x,y,r
    
  

     /* Write strings to the buffer */
    // paint_red.DrawFilledRectangle(0, 0, 400, 30, UNCOLORED);//x1,y1,x2,y2,Diagonal point
    // paint_red.DrawStringAt(140, 8, "--Qiyun display--", &Font12, COLORED);//x,y
    // paint_black.DrawStringAt(153, 40, "initing...", &Font12, COLORED);//x,y   

    // /* Display the frame_buffer */
    // epd.SetFrameScreen_ALL(frame_black, frame_red);
    // epd.DisplayFrame();
    // epd.DelayMs(3000);

  
    // all refresh
    // epd.SetFrameScreen_BW(gImage_5_RED);
    // epd.DisplayFrame();
    // epd.DelayMs(5000);
    
    //  //all refresh
    // epd.SetFrameScreen_ALL(gImage_2_BW,gImage_2_RED);
    // epd.DisplayFrame();
    // epd.DelayMs(2000);   
    
    // all white
    // epd.ClearFrameMemory();
    // epd.DisplayFrame();
    // epd.DelayMs(100);    
 
    PaintClock(epd);

   
    epd.DisplayFrame();

    epd.Sleep();
    while (1) 
    return 0;
}

